package org.example.bio.ch1;

import java.io.IOException;
import java.net.Socket;

public class Client2 {

    public static void main(String[] args) {

        try {
            Socket socket = new Socket("127.0.0.1", 8000);

            while (true){
                String msg = "hello world2";
                socket.getOutputStream().write(msg.getBytes());
                System.out.println("发送数据");
                Thread.sleep(5000);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
